#include "EasyXMen_sm2_Cfg.h"
#include "Platform_Types.h"

#define ON 1
#define OFF 0
#define PLUS 1
#define MINUS (-1)

#define XMEN_OVER       0
#define XMEN_ADD        1
#define XMEN_DOUBLE     2

#define XMEN_PROJECTIVE 0
#define XMEN_AFFINE     1
#define XMEN_BEST       2
 
#define XMEN_EPOINT_GENERAL    0
#define XMEN_EPOINT_NORMALIZED 1
#define XMEN_EPOINT_INFINITY   2

/* error returns */
#define XMEN_ERR_BASE_TOO_BIG       1
#define XMEN_ERR_DIV_BY_ZERO        2
#define XMEN_ERR_OVERFLOW           3
#define XMEN_ERR_NEG_RESULT         4
#define XMEN_ERR_BAD_FORMAT         5
#define XMEN_ERR_BAD_BASE           6
#define XMEN_ERR_BAD_PARAMETERS     7
#define XMEN_ERR_OUT_OF_MEMORY      8
#define XMEN_ERR_NEG_ROOT           9
#define XMEN_ERR_NEG_POWER         10
#define XMEN_ERR_BAD_ROOT          11
#define XMEN_ERR_INT_OP            12
#define XMEN_ERR_FLASH_OVERFLOW    13
#define XMEN_ERR_TOO_BIG           14
#define XMEN_ERR_NEG_LOG           15
#define XMEN_ERR_DOUBLE_FAIL       16
#define XMEN_ERR_IO_OVERFLOW       17
#define XMEN_ERR_NO_MIRSYS         18
#define XMEN_ERR_BAD_MODULUS       19
#define XMEN_ERR_NO_MODULUS        20
#define XMEN_ERR_EXP_TOO_BIG       21
#define XMEN_ERR_NOT_SUPPORTED     22
#define XMEN_ERR_NOT_DOUBLE_LEN    23
#define XMEN_ERR_NOT_IRREDUC       24
#define XMEN_ERR_NO_ROUNDING       25
#define XMEN_ERR_NOT_BINARY        26
#define XMEN_ERR_NO_BASIS          27
#define XMEN_ERR_COMPOSITE_MODULUS 28

extern void EasyXMen_sm2_sign(unsigned char* hash, int hashlen, unsigned char* privkey, int privkeylen, unsigned char* cr, int* rlen, unsigned char* cs, int* slen);
extern int EasyXMen_sm3Hash(unsigned char* userid, int userid_len, unsigned char* xa, int xa_len, unsigned char* ya, int ya_len, unsigned char* msg, int msg_len, unsigned char* e);
extern int EasyXMen_sm2_verify(unsigned char* hash, int hashlen, unsigned char* cr, int rlen, unsigned char* cs, int slen, unsigned char* wx, int wxlen, unsigned char* wy, int wylen);
extern void Crypto_SM2_signProcess();
extern void Crypto_SM2_verifyProcess();